package c_001;

public class T02 {
    private int count = 10;
    private Object o = new Object();

    public void m(){
        synchronized (this){ //每次new一个对象太麻烦,可以直接这样写
            count--;
            System.out.println(Thread.currentThread().getName() + " count = " + count);
        }
    }

    //n和m两个等值(里面的代码执行时等值的)
    public synchronized void n(){
        count--;
        System.out.println(Thread.currentThread().getName() + " count = " + count);
    }
}
